package online.misscl.lsy.controller.back;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import online.misscl.lsy.controller.BaseController;
import online.misscl.lsy.entity.dto.VaccineAppointmentQueryDto;
import online.misscl.lsy.entity.dto.vo.TableDataInfoVo;
import online.misscl.lsy.entity.dto.vo.VaccineAppointmentBackVo;
import online.misscl.lsy.service.VaccineAppointmentService;
import online.misscl.lsy.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * project name: IntelliJ IDEA
 * Date: 2023/3/11 13:01
 *
 * @PackageName: online.misscl.lsy.controller.back
 * @ClassName: VaccineSortController
 * @Author: code mover
 * @Version:
 * @Description:
 */
@Api(tags = "疫苗分类管理")
@RestController
@RequestMapping("/back")
public class VaccineOrderController extends BaseController {
//
//    @Autowired
//    private VaccineSortService vaccineSortService;
//
//    @Autowired
//    private HospitalInformationServiceImpl hospitalInformationService;

    @Autowired
    private VaccineAppointmentService vaccineAppointmentService;

    @ApiOperation("内嵌page的条件查询")
    @GetMapping("/vaccineOrder")
    public TableDataInfoVo<List<VaccineAppointmentBackVo>> queryList(VaccineAppointmentQueryDto dto){
        List<VaccineAppointmentBackVo> list = vaccineAppointmentService.queryAppointment(dto);
        Page page = PageUtil.getPages(dto.getPageNum(),dto.getPageSize(),list);
        return getDataTable(page.getRecords(),page.getTotal());
    }

//    @ApiOperation("获取单个分类")
//    @GetMapping("/vaccineSort/{vaccineSortId}")
//    public AjaxResult getOne(@PathVariable Integer vaccineSortId){
//        return AjaxResult.success(vaccineSortService.getOneVaccineSortVo(vaccineSortId));
//    }
//
//    @ApiOperation("模糊搜索医院名称")
//    @GetMapping("/vaccineOrderVague")
//    public TableDataInfoVo<List<VaccineSortVo>> vagueList(String key){
//        LambdaQueryWrapper<HospitalInformation> qw = new LambdaQueryWrapper<HospitalInformation>();
//        qw.select(HospitalInformation::getHospitalName,HospitalInformation::getHospitalId)
//                .like(HospitalInformation::getHospitalName,key);
//        List<HospitalInformation> list = hospitalInformationService.list(qw);;
//        Page page = PageUtil.getPages(1,10,list);
//        return getDataTable(page.getRecords(),page.getTotal());
//    }
//
//
//
//    @ApiOperation("删除分类")
//    @DeleteMapping("/vaccineSort/{vaccineSortId}")
//    public AjaxResult deleteVaccineSort(@PathVariable Integer vaccineSortId){
////        LambdaQueryWrapper
//        return toAjax(vaccineSortService.deleteVaccineSort(vaccineSortId));
//    }
//    @ApiOperation("修改分类")
//    @PutMapping("/vaccineOrder")
//    public AjaxResult updateVaccineSort(@RequestBody VaccineSortUpdateDTO vaccineSortUpdateDTO){
////        获取字典表中对应id
//        Integer vaccineSortId = vaccineSortService.getVaccineSortId(vaccineSortUpdateDTO);
////        修改关联表
//        if(vaccineSortId!=0)
//            return toAjax(vaccineSortService.updateVaccineSort(
//                    new VaccineSortHospital(
//                    vaccineSortUpdateDTO.getId()
//                    ,vaccineSortId
//                    ,vaccineSortUpdateDTO.getHospitalId())));
//        else{
//            return AjaxResult.error("分类名已存在，修改取消");
//        }
//
//    }
//
//
//    @ApiOperation("新增分类")
//    @PostMapping("/vaccineOrder")
//    public AjaxResult saveVaccineSort(@RequestBody VaccineSortUpdateDTO vaccineSortUpdateDTO){
////        将获取分类字典中的id查出并添加在关联表中
//         Integer vaccineSortId = vaccineSortService.getVaccineSortId(vaccineSortUpdateDTO);
//        if(vaccineSortId!=0)
//            return toAjax(vaccineSortService.saveVaccineSort(new VaccineSortHospital(vaccineSortId,vaccineSortUpdateDTO.getHospitalId())));
//        else{
//            return AjaxResult.error("分类名已存在，新增取消");
//        }
//    }


}
